import 'package:boss/provider/material_provider.dart';
import 'package:boss/ui/widget/button/fixed_bottom_btn.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'material_picker_list.dart';
import 'material_picker_plus_btn.dart';
import 'material_picker_search_bar.dart';

class MaterialPickerBrowser extends StatefulWidget {
  @override
  _MaterialPickerBrowserState createState() => _MaterialPickerBrowserState();
}

class _MaterialPickerBrowserState extends State<MaterialPickerBrowser> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Expanded(
            child: SingleChildScrollView(
              padding: EdgeInsets.symmetric(
                horizontal: 30.w,
                vertical: 30.w,
              ),
              child: Column(
                children: <Widget>[
                  MaterialPickerSearchBar(),
                  MaterialPickerList(),
                  MaterialPickerPlusBtn(),
                ],
              ),
            ),
          ),
          FixedBottomBtn(
            title: '保存',
            onTap: () {
              var materialProvider = Provider.of<MaterialProvider>(
                context,
                listen: false,
              );
              Navigator.pop(context, materialProvider.selectedMaterials);
            },
          ),
        ],
      ),
    );
  }
}
